using System;
using System.ComponentModel;
using SmartLink.Domain.Attribute;
namespace SmartLink.Domain.Entity
{

    /// <summary>
    /// 角色
    /// </summary>	
    [Serializable]
    [TableName("PER_RoleGroup")]
    public class PER_RoleGroup : BaseEntity
    {
        #region Model	

        /// <summary>
        /// 编号
        /// </summary>
        [Description("编号")]
        public string No { get; set; }

        /// <summary>
        /// 公司ID
        /// </summary>
        [Description("公司ID")]
        public int OID { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>		
        [Description("角色名称")]
        public string RoleName { get; set; }

        /// <summary>
        /// 角色描述
        /// </summary>		
        [Description("角色描述")]
        public string RoleDesc { get; set; }

        /// <summary>
        /// 启用标志
        /// </summary>
        [Description("启用标志")]
        public int Enabled { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Description("创建人")]
        public int Creator { get; set; }

        /// <summary>
        /// 创建人名称
        /// </summary>
        [Description("创建人名称")]
        public string CreatorName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Description("创建时间")]
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 删除标志
        /// </summary>		
        [Description("删除标志")]
        public bool IsDel { get; set; }

        /// <summary>
        /// 是否系统内置
        /// </summary>
        [Description("是否系统内置")]
        public bool IsBuildin { get; private set; }

        #endregion Model

        #region 扩展方法

        public void Create(int userId, int oid, string creatorName)
        {
            OID = oid;
            Creator = userId;
            CreatorName = creatorName;
            CreateTime = DateTime.Now;
            IsDel = false;
        }

        public void GenerateNo(Func<string> generateMethod)
        {
            this.No = generateMethod();
        }

        #endregion
    }
}